const {
    Mysql
} = require('../tools/utils');
module.exports = async (ctx) => {
    let {
        uid,
        vid
    } = ctx.query;
    if (uid == 'undefined' || vid == 'undefined') {
        ctx.state.data = {
            code: '002'
        };
        return;
    } else {
        // let sql = `SELECT orderList.money,cSessionInfo.user_info FROM orderList RIGHT JOIN cSessionInfo ON orderList.uid=cSessionInfo.uid WHERE orderList.vid=${vid} AND orderList.uid = ${uid}`;
        // let sql = `SELECT orderList.money,cSessionInfo.user_info FROM orderList RIGHT JOIN cSessionInfo ON orderList.uid=cSessionInfo.uid WHERE orderList.vid=${vid}`;
        let sql = `SELECT orderList.money,orderList.create_time,cSessionInfo.user_info FROM orderList RIGHT JOIN cSessionInfo ON orderList.uid=cSessionInfo.uid WHERE orderList.vid=${vid} ORDER BY create_time DESC`;
        try {
            let res = await Mysql(sql);
            ctx.state.data = {
                list: res,
                code: '001'
            }
        } catch (error) {
            ctx.state.data = {
                code: '002'
            }
        }
    }
}